﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Mock1G3.DataAccess;
using Mock1G3.BaseEntities;
using System.Data;
using System.Text.RegularExpressions;

namespace Mock1G3.BussinessLogic
{
    public class AccountTransferLogic
    {
        public bool IsNumber(string str)
        {
            Regex regex = new Regex(@"^[-+]?[0-9]*\.?[0-9]+$");
            return regex.IsMatch(str);
        }

        public DataTable GetAccountReceive(Account account)
        {
            return DataAccess.AccountTransferAccess.GetAccountReceive(account.AccountNoRev);
        }

        public bool CheckAccountReceive(Account account)
        {
            if (account.AccountNoRev.Length <= 50)
            {
                DataTable dt = GetAccountReceive(account);
                if (dt.Rows.Count != 0)
                    return true;
            }
            return false;
        }

        public DataTable GetAccountSend(Account account)
        {
            return DataAccess.AccountTransferAccess.GetAccountSend(account.AccountNo);
        }       
    }
}